# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-jba-templatecheck
pkgver=0.6.0
pkgrel=1
pkgdesc="Check Go templates for validity"
arch=('any')
url="https://github.com/jba/templatecheck"
license=('MIT')
depends=('go' 'golang-github-google-safehtml')
source=("$pkgname-$pkgver.tar.gz::https://github.com/jba/templatecheck/archive/v$pkgver.tar.gz")
sha512sums=('c8c86f2be66948749e4c5e7fedd496e4c3b9b422cf5e1543e9334842de9a33ff4959fee8b82e2c14d42ff277579d74faaf83f498d93e758b6dd966354a1f5b4c')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/jba
  cp -a "$srcdir"/templatecheck-$pkgver "$srcdir"/build/src/github.com/jba/templatecheck
  cd "$srcdir"/build/src/github.com/jba/templatecheck
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/jba
  cp -a "$srcdir"/templatecheck-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/jba/templatecheck

  install -Dm644 templatecheck-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
